package com.yunfeisoft.business.service.impl;

import com.yunfeisoft.business.dao.inter.ReceiptDao;
import com.yunfeisoft.business.model.Receipt;
import com.yunfeisoft.business.service.inter.ReceiptService;
import com.yunfeisoft.common.base.BaseServiceImpl;
import com.yunfeisoft.common.sql.separation.DataSourceChange;
import com.yunfeisoft.common.utils.Page;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * ClassName: ReceiptServiceImpl
 * Description: 收款单service实现
 * Author: Jackie liu
 * Date: 2020-04-01
 */
@Service("receiptService")
public class ReceiptServiceImpl extends BaseServiceImpl<Receipt, String, ReceiptDao> implements ReceiptService {

    @Override
    @DataSourceChange(slave = true)
    public Page<Receipt> queryPage(Map<String, Object> params) {
        return getDao().queryPage(params);
    }

    @Override
    public int modifyStatus(String id, int status) {
        if (StringUtils.isBlank(id)) {
            return 0;
        }

        Receipt receipt = new Receipt();
        receipt.setId(id);
        receipt.setStatus(status);
        return getDao().update(receipt);
    }

}